home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / coding / 80x86 / code32.lzh / EXAMPLE0.ASM < prev    next >
Assembly Source File  |  1993-01-09  |  2KB  |  88 lines

  1.         .386p
  2.         jumps
  3. code32  segment para public use32
  4.         assume cs:code32, ds:code32, ss:code32
  5.  
  6. include start32.inc     ; All externs are defined in there
  7.  
  8. public  _main
  9.  
  10. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  11. ; DATA
  12. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  13. msg0            db      'Free low mem:  '
  14. msg0len=$-msg0
  15. msg1            db      'Free high mem: '
  16. msg1len=$-msg1
  17.  
  18. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  19. ; CODE
  20. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  21.  
  22. ;═════════════════════════════════════════════════════════════════════════════
  23. _main:
  24.         @rlp edi,0b8000h                ; fill text screen with stuff
  25.         mov ecx,80*25
  26.         mov al,'▒'
  27.         mov ah,78h
  28.         rep stosw
  29.  
  30.         mov ah,0fh                      ; put amount of free low mem
  31.         @rlp edi,0b8000h+2*160+4
  32.         mov esi,offset msg0
  33.         mov ecx,msg0len
  34. mainl0:
  35.         lodsb
  36.         stosw
  37.         loop mainl0
  38.         call _lomemsize
  39.         call putnum
  40.  
  41.         @rlp edi,0b8000h+3*160+4        ; put amount of free high mem
  42.         mov esi,offset msg1
  43.         mov ecx,msg1len
  44. mainl1:
  45.         lodsb
  46.         stosw
  47.         loop mainl1
  48.         call _himemsize
  49.         call putnum
  50.  
  51. ; Uncomment this and the next piece of code if you have a mouse driver loaded
  52. ; and want to test the handling of real-mode IRQs.
  53. ;       mov v86r_ax,0                   ; Enable and unhide mouse cursor
  54. ;       mov al,33h
  55. ;       int 30h
  56. ;       mov v86r_ax,1
  57. ;       int 30h
  58.  
  59.         mov v86r_ah,0                   ; INT 16h, AH=0, wait for keypress
  60.         mov al,16h
  61.         int 30h
  62.  
  63. ;       mov v86r_ax,0                   ; Disable mouse
  64. ;       mov al,33h
  65. ;       int 30h
  66.  
  67.         jmp _exit                       ; return to real mode
  68.  
  69. ;-----------------------------------------------------------------------------
  70. putnum:                                 ; put EAX to EDI
  71.         mov edx,eax
  72.         mov ecx,8
  73.         mov ebx,offset _hextbl
  74.         mov ah,0fh
  75. putnuml0:
  76.         rol edx,4
  77.         mov al,dl
  78.         and al,0fh
  79.         xlat
  80.         stosw
  81.         loop putnuml0
  82.         ret
  83.  
  84.  
  85. code32  ends
  86.         end
  87.  
  88.